import request from '@/utiles/request.js'

export const getMyUserInfo = async () => {
  return await request.get('/publish/userinfo')
}

export const getPersonalData = async () => {
  return await request.get('/publish/persondata')
}

export const getMyPostData = async () => {
  return await request.get('/publish/mypostdata')
}

export const getTags = async (tagName) => {
  return await request.get('/publish/tags',{
    params: tagName
  })
}

export const addPost = async (post) => {
  return await request.put('/publish/post',post)
}

export const deletePost = async (postId) => {
  return await request.delete(`/publish/post/${postId}`)
}

export const updateByVisibility = async (postId, visibility) => {
  return await request.post('/publish/post/visibility', null, {
    params: {
      postId,
      visibility
    }
  })
}

export const updatePost = async (post) => {
  return await request.post('/publish/post',post)
}

export const getPostData = async () => {
  return await request.get('/publish/postdata')
}

export const getFansData = async () => {
  return await request.get('/publish/fansdata')
}
